package com.ibigcat.module.mdm.dao.mapper;

import java.util.*;

import com.ibigcat.framework.common.pojo.PageResult;
import com.ibigcat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.ibigcat.framework.mybatis.core.mapper.BaseMapperX;
import com.ibigcat.module.mdm.dao.entity.BrandDO;
import org.apache.ibatis.annotations.Mapper;
import com.ibigcat.module.mdm.controller.admin.brand.vo.*;

/**
 * 品牌管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BrandMapper extends BaseMapperX<BrandDO> {

    default PageResult<BrandDO> selectPage(BrandPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BrandDO>()
                .likeIfPresent(BrandDO::getBrandName, reqVO.getBrandName())
                .eqIfPresent(BrandDO::getBrandCode, reqVO.getBrandCode())
                .eqIfPresent(BrandDO::getCategory, reqVO.getCategory())
                .eqIfPresent(BrandDO::getCompany, reqVO.getCompany())
                .eqIfPresent(BrandDO::getDescription, reqVO.getDescription())
                .eqIfPresent(BrandDO::getEntranceInd, reqVO.getEntranceInd())
                .eqIfPresent(BrandDO::getDisabled, reqVO.getDisabled())
                .betweenIfPresent(BrandDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BrandDO::getId));
    }

}